# Carbon Jiao <http://archlive-pkg.googlecode.com>

pkgname=larchin-svn
_realpkgname=larchin
pkgver=407
pkgrel=1
pkgdesc="larch项目之一，安装archlive系统到硬盘, 加入了中文支持"
url="http://larch.berlios.de"
depends=('pygtk' 'larchin-syscalls-svn')
source=("${_realpkgname}_zh_CN.po" "${_realpkgname}_zh_TW.po" "${_realpkgname}.desktop")
arch=(i686 x86_64)
license=('GPL')

_svnmod="larchin"
_svntrunk="http://svn.berlios.de/svnroot/repos/larch/branches/larch6/$_svnmod"

build() {
  cd $startdir/src
  msg "Connecting to $_svnmod SVN server...."
  svn co $_svntrunk $_svnmod -r $pkgver 

  msg "SVN checkout done or server timeout"
  cd $_svnmod
  msg "Starting make..."

  mkdir -p ${pkgdir}/opt/larchin
  cp -dr ${srcdir}/${_realpkgname}/modules ${pkgdir}/opt/larchin
  ${srcdir}/${_realpkgname}/compile.py ${pkgdir}/opt/larchin/modules
  cp -dr ${srcdir}/${_realpkgname}/etc ${pkgdir}
  cp -dr ${srcdir}/${_realpkgname}/run ${pkgdir}/opt/larchin
  cp -dr ${srcdir}/${_realpkgname}/i18n ${pkgdir}/opt/larchin
  mkdir -p ${pkgdir}/usr/share/pixmaps
  cp ${srcdir}/${_realpkgname}/larchin1.jpg ${pkgdir}/usr/share/pixmaps
  cp ${srcdir}/${_realpkgname}/larchin.png ${pkgdir}/usr/share/pixmaps
  cp ${srcdir}/${_realpkgname}/larchin2.png ${pkgdir}/usr/share/pixmaps
  mkdir -p ${pkgdir}/usr/share/applications
  cp ${srcdir}/${_realpkgname}.desktop ${pkgdir}/usr/share/applications
  mkdir -p ${pkgdir}/opt/larchin/i18n/{zh_CN,zh_TW}/LC_MESSAGES
  msgfmt ${srcdir}/${_realpkgname}_zh_CN.po -o ${pkgdir}/opt/larchin/i18n/zh_CN/LC_MESSAGES/${_realpkgname}.mo
  msgfmt ${srcdir}/${_realpkgname}_zh_TW.po -o ${pkgdir}/opt/larchin/i18n/zh_TW/LC_MESSAGES/${_realpkgname}.mo
  chmod 755 ${pkgdir}/opt/larchin/i18n/{zh_CN,zh_TW}/LC_MESSAGES/${_realpkgname}.mo
  chmod 755 ${pkgdir}/usr/share/applications/${_realpkgname}.desktop
  #find ${pkgdir}/usr/share/locale -type f \( -name "zh_CN.po"  -o -name "zh_TW.po" \)  -exec rm -f {} \;
  find ${pkgdir} -regex '.*\.pyc' -type f -exec rm '{}' \;
  rm -rf `find ${pkgdir} -name ".svn" -type d`

}
